from pydantic import BaseModel
from typing import Optional, List, Any
from enum import Enum

class QuestionType(str, Enum):
    CHOICE = "choice"
    FILL = "fill"
    SOLVE = "solve"

class QuestionBase(BaseModel):
    content: str
    type: QuestionType
    options: Optional[List[str]] = None
    correct_answer: str
    explanation: Optional[str] = None
    difficulty: int
    score: int = 5
    grade_id: int
    knowledge_point_id: int

class QuestionCreate(QuestionBase):
    pass

class Question(QuestionBase):
    id: int
    created_at: Optional[str] = None
    updated_at: Optional[str] = None
    
    class Config:
        from_attributes = True

class QuestionWithAnswer(Question):
    user_answer: Optional[str] = None
    is_correct: Optional[bool] = None